package com.tedu.system.controller;

import com.tedu.common.response.JsonResult;
import com.tedu.system.pojo.dto.SystemLoginParam;
import com.tedu.system.pojo.vo.SystemVO;
import com.tedu.system.service.SystemService;
import com.tedu.user.pojo.vo.UserVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j//添加日志的注解
@RestController
@RequestMapping("v1/system")
public class  SystemController {
    @Autowired
    private SystemService systemService;

    @PostMapping("login")
    public JsonResult login(@RequestBody SystemLoginParam systemLoginParam){
        log.debug("用户登录:systemLoginParam={}",systemLoginParam);
        //调用业务层的login方法,并传入前端传过来的参数userLoginParam
        SystemVO systemVO =systemService.login(systemLoginParam);
        //将业务层返回的userVO对象封装到JsonResult中返回给前端
        return JsonResult.ok(systemVO);
    }
}
